package com.simplerobot.robot;

import com.simplerobot.consume.PageConsume;

/**
 * 爬虫
 * Created by liangcq on 2017/3/29.
 */
public abstract class Spider {

    /*爬虫名称*/
    protected String spiderName;
    /*爬取线程数*/
    protected int threadNumber = 2;
    /*域名*/
    protected String domain;

    /*url*/
    protected String url;

    protected PageConsume pageConsume;

    public Spider() {
    }
    public Spider(PageConsume pageConsume) {
        this.pageConsume = pageConsume;
    }

    public PageConsume getPageConsume() {
        return pageConsume;
    }

    public String getSpiderName() {
        return spiderName;
    }

    public void setSpiderName(String spiderName) {
        this.spiderName = spiderName;
    }
    public void setPageConsume(PageConsume pageConsume) {
        this.pageConsume = pageConsume;
    }
    /**
     * 运行爬虫
     */
    public  abstract void run();

    /**
     * 停止爬虫
     */
    public abstract void stop();

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public int getThreadNumber() {
        return threadNumber;
    }

    public void setThreadNumber(int threadNumber) {
        this.threadNumber = threadNumber;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }
}
